//
//  SXQr-CodeDetailViewController.m
//  ShiXun
//
//  Created by lanou on 15/11/4.
//  Copyright © 2015年 张琪. All rights reserved.
//

#import "SXQr-CodeDetailViewController.h"

@interface SXQr_CodeDetailViewController ()

@property (nonatomic, strong) UIWebView *webView;
@property (nonatomic, strong) UILabel *strLabel;

@end

@implementation SXQr_CodeDetailViewController

- (UIWebView *)webView
{
    if (!_webView) {
        _webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 64, kScreenWidth, kScreenHeight - 64)];
    }
    return _webView;
}

- (UILabel *)strLabel
{
    if (!_strLabel) {
        _strLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 64, kScreenWidth, 100)];
        _strLabel.numberOfLines = 0;
        _strLabel.textAlignment = NSTextAlignmentCenter;
    }
    return _strLabel;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.automaticallyAdjustsScrollViewInsets = NO;
    self.view.backgroundColor = [UIColor whiteColor];
    
    if ([_qrCodeString hasPrefix:@"http"]) {
        [self.view addSubview:self.webView];
        [_webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:_qrCodeString]]];
    }
    else
    {
        [self.view addSubview:self.strLabel];
        _strLabel.text = _qrCodeString;
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
